
package com.android.matmanual;

import java.util.HashMap;
import java.util.Map;

import android.app.Activity;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.TextView;

public class RFTest extends Activity {
	TextView rfcalTV;
	TextView rfverifyTV;
	WakeLock mWakeLock;
	static Map<String,String> data = new HashMap<String,String>();
	static{
		data.put("U","untested");
		data.put("P","pass");
		data.put("F","fail");
		data.put("B","bypass next station");
		data.put("-","untested");
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.rftest);
		setTitle(R.string.rf_test);
		
	    PowerManager pm =
		           (PowerManager) getSystemService(POWER_SERVICE); 
	    mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, 
		          "XYTEST"); 
		mWakeLock.acquire(); 
		rfcalTV=(TextView)findViewById(R.id.rfcal);
		rfverifyTV=(TextView)findViewById(R.id.rfverify);
		
	/*	String rfinfo = NvUtils.readFactoryData3();
		
		if(null != rfinfo && !rfinfo.equals(""))
		{
			String rfcal = rfinfo.substring(1,2);
			String rfverify = rfinfo.substring(2,3);
			
			rfcalTV.setText("rfcal:"+data.get(rfcal));
			rfverifyTV.setText("rfverify:"+data.get(rfverify));
		}else
		{
			rfcalTV.setText("rfcal:untested");
			rfverifyTV.setText("rfverify:untested");		
		}

		*/
		
		
	}
	


	
	 @Override
	 public boolean onKeyDown(int keyCode, KeyEvent event) {
		 	

		 	if(keyCode == KeyEvent.KEYCODE_BACK)
		 	{
				finish();
		 	}	 
		 	return true;
	 	}
	    @Override
	    protected void onDestroy() {
	    	// TODO Auto-generated method stub
			if(mWakeLock!=null)
			{
				mWakeLock.release(); 
				mWakeLock = null;
			}
	    	super.onDestroy();
	    }	 
	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
       finish();
		super.onStop();
	}

	@Override
	public void onAttachedToWindow() 
	{
		// TODO Auto-generated method stub
		super.onAttachedToWindow();
		this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
	}

}
		 